package business;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import service.myService.judge.JudgeService;
import service.myService.judge.OneJudgeServiceImpl;
import service.vo.MessageVo;
import struts.action.Action;
import struts.form.ActionForm;

public class JudgeAction implements Action {

    @Override
    public String execute(HttpServletRequest request,HttpServletResponse response,ActionForm form,Map<String,String> map){
        String url = "";
//        JudgeService service = new JudgeServiceImpl();
        JudgeService service = new OneJudgeServiceImpl();
        Map<String,MessageVo> mapMess = service.getMessageVo(request.getParameter("text"));
        Set<String> set = mapMess.keySet();
        for (Iterator<String> it = set.iterator(); it.hasNext();){
            url = it.next();
            request.setAttribute("mess", mapMess.get(url));
        }
        return url;
    }

}
